<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ page import="java.util.List,java.util.Map,java.math.BigDecimal"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
List list = (List) request.getAttribute("list");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd 

">
<html>
<head>
 <base href="<%=basePath%>">   
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
 <link rel="stylesheet" href="css/common.css" />
    <link rel="stylesheet" href="css/invest.css">
    <!--<link rel="stylesheet" href="lib/css/pullToRefresh.css">-->
    <link rel="stylesheet" href="lib/css/dropload.css" />
    <title>售出记录</title>
    <style>
        .ci_img {
            width: 0.4rem;
            height: 0.4rem;
            vertical-align: middle;
            margin-left: 0.1rem;
        }
        #ci_wrap {
            height: 100%;
            width: 100%;
            background: #ffffff;
        }
        #ci_wrap .ci_title {
            height: 0.8rem;
            width: 100%;
            text-align: center;
            line-height: 0.8rem;
            background: #ffffff;
            font-size: 0.30rem;
        }
        #ci_wrap .ci_title >span {
            color: #00a0e9;
        }
        #ci_wrap .ci_title2 {
            background: #f3f3f3;
            height: 0.8rem;
            width: 100%;
            border-top: 1px solid #cccccc;
            border-bottom: 1px solid #cccccc;
            color: black;
        }
        #ci_wrap .ci_title2 >li {
            width: 33%;
            float: left;
            text-align: center;
            line-height: 0.78rem;
            font-size: 0.32rem;
        }
        .bottom_border {
            border-bottom: 1px solid #cccccc;
        }
        #ci_wrap .bg {
            background: #ffffff;
        }
        #ci_wrap .list_wrap {
            width: 100%;
            height: 70%;
            background: #ffffff;
        }
        .list_wrap .list_box {
            /*插件新增样式*/
            position: absolute;
            width:100%;
            /* height: 100%;*/
            margin: 0 auto;
            top:2.6rem;
            bottom: 0;
            overflow-y: scroll;
        }
        .list_wrap .list_box ul {
            width: 100%;
            /*padding-bottom: 2.0rem;*/
        }
        .list_wrap .list_box ul >li {
            height: 1.0rem;
            width: 100%;
            overflow: hidden;
            border-bottom: 1px solid #cccccc;
        }
        .list_wrap .list_box ul >li >div {
            width: 33%;
            height: 100%;
            text-align: center;
            line-height: 1.0rem;
            float: left;
            font-size: 0.26rem;
        }
        .list_wrap .list_box ul >li >div span {
            color: #fa6557;
        }
        .phone_type{
            width: 0.26rem;
            vertical-align: middle;
            margin-left: 0.2rem;
        }

    </style>
    <script src="lib/js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="overflow: hidden">
<!--  公共头部 -->
<section id="sp_common_header" class="sp_common_title" style="display:none;">
    <a href="javascript:history.go(-1)">
        <i class="icon"></i>
    </a>
    <span>售出记录</span>
</section>
<!--   内容   -->
<section id="ci_wrap">
 
    <ul class="ci_title2">
        <li>交易时间</li>
         <li>价格</li><li>交易数额</li>
    </ul>
    <div class="list_wrap">
        <div class="list_box" id="wrapper">
            <ul>
                <% for(int i=0;i<list.size();i++){
				Map map = (Map)list.get(i);
				%>
				<li class="clearfix">
                <div class="item">
                    <span><%=map.get("tratime")%></span>
                 </div>
                <div class="item">
                    <span><%=map.get("income")%></span>
                 </div>
                 <div class="item">
                     <span class="cancel_withdraw"><%=map.get("goods")%></span>
                </div>
            </li>
				<%
				}
				%>
            </ul>
        </div>
    </div>

</section>
<!-- 底部 -->
<!--<section id="sp_footer">-->
<!--</section>-->
</body>

<script type="text/javascript" src="lib/js/jquery.base64.js"></script>
<script src="lib/js/dropload.min.js" type="text/javascript" charset="utf-8"></script>

<script type="text/javascript">
    (function(){
        var pageRows = 10,pageNumber = 1;
        var bo_id,_$investNum,_$ulSelector,iv_name,iv_amout,iv_date;
        var li_str;
        var count;
        var cur_username;//当前用户名
        _$investNum = $('#ci_wrap .ci_title').find('span');
        _$ulSelector = $('#ci_wrap .list_box').find('ul');
        var v = parseUrl();
        bo_id = v['id'];

        //        判断用户是否登录
        var uid = getUIDByJWT1().unique_name;
        var prameter = '';
        if (uid == undefined) {
//           未登录
            prameter = "Invest/Record?id=" + bo_id + "&pageRows=" + pageRows + "&pageNumber=" + pageNumber;
            comptime(1);
        }else {
            prameter = "Invest/Inrecord?uid="+ uid +"&bid=" + bo_id + "&pageRows=" + pageRows + "&pageNumber=" + pageNumber;
            comptime(1);
        }

        var dropload = $("#wrapper").dropload({
            domUp: {
                domClass: 'dropload-up',
                domRefresh: '<div class="dropload-refresh">↓下拉刷新</div>',
                domUpdate: '<div class="dropload-update">↑释放更新</div>',
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>'
            },
            domDown: {
                domClass: 'dropload-down',
                domRefresh: '<div class="dropload-refresh">↑上拉加载更多</div>',
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                domNoData: '<div class="dropload-noData">暂无数据</div>'
            },
            loadUpFn:function(me){
                setTimeout(function(){
                    pageNumber = 1;
//	        		 刷新时先把页面清空
                    _$ulSelector.empty();
                    comptime(pageNumber);
                    dropload.resetload();
                },1000)
            },
            loadDownFn: function (me){
                setTimeout(function(){
                    pageNumber++;
                    comptime(pageNumber);
                    dropload.resetload();
                },1000);
            },
            autoLoad : false
        });

        function comptime() {
            if (uid == undefined) {
//           未登录
                prameter = "Invest/Record?id=" + bo_id + "&pageRows=" + pageRows + "&pageNumber=" + pageNumber;
            }else {
                prameter = "Invest/Inrecord?uid="+ uid +"&bid=" + bo_id + "&pageRows=" + pageRows + "&pageNumber=" + pageNumber;
            }
            $.ajax({
                type: "GET",
                url: getAPIURL() + prameter,
                dataType: "json",
                data: null,
                success: function (data) {
                    var list = data;
                    if(list.InvestPersons.length>0) {
                        count = list.Count.toString();
                        if (pageNumber<=1) _$investNum.text(count);
                        for (var i = 0;i<list.InvestPersons.length;i++) {
                            iv_name = list.InvestPersons[i].Name;
//                            if (iv_name == cur_username) {
//                                iv_name = cur_username;
//                            }
                            iv_amout = list.InvestPersons[i].InvestAmount;
                            iv_date = list.InvestPersons[i].InvestDate;
                            var investdevice = list.InvestPersons[i].InvestMode;
                            var tz_type = "";
                            if(investdevice == "PC"){
                                tz_type = "img/icon_pc.png"
                            }else if(investdevice == "IOS"){
                                tz_type = "img/icon_ios.png"
                            }else if(investdevice == "ANDROID"){
                                tz_type = "img/icon_andriod.png"
                            }else{
                                tz_type = "img/icon_other.png"
                            }
//                         	if(pageNumber<=1){
                            li_str = '<li><div class="bottom_border">' + iv_name+"<img class='phone_type' src='"+tz_type+"' />" +'</div><div class="bottom_border"><span>' + iv_amout + '</span></div> <div class="bottom_border">' + iv_date +'</div></li>';
//                         		_$ulSelector.empty().append(li_str);
//                         	}
                            _$ulSelector.append(li_str);
                        }

                        if(list.Count <10){
                            $('.dropload-down .dropload-refresh').text('无更多数据')
                        }

                    }else {
                        if (pageNumber>1&&list.InvestPersons.length ==0){
                            $('.dropload-down .dropload-refresh').text('无更多数据');
                        }
                        if (pageNumber <=1&&list.InvestPersons.length==0){
                            $('#ci_wrap').html('<p style="text-align: center;padding: 0.3rem 0;font-size: 0.28rem;">无投资记录</p><div style="width: 100%;text-align: center"><img style="width: 60%" src="img1/pic02.png" alt=""></div>');
                        }
//                      refresher.info.pullUpLable = '无更多记录';
//                      $('#wrapper .pullUpLabel').text('无更多记录');
                    }
                }
            });
        };
//        comptime();
//        接口
//        Invest/Record?id=xxx&pageRows=xx&pageNumber=xxx
    })();
</script>
<!--头部-->
<script src="lib/js/RainbowBridge.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    setTitle(".sp_common_title", {'title':'投资记录'});
</script>
</html>